package cn.crawler.app.crown.commons.websocket.action;

import cn.crawler.app.crown.commons.websocket.filter.EncryptFilter;
import cn.crawler.app.crown.commons.websocket.main.action.BaseNettyAction;
import cn.crawler.app.crown.commons.websocket.main.action.NettyAction;
import cn.crawler.app.crown.commons.websocket.main.base.NettyRouter;
import cn.crawler.app.crown.commons.websocket.main.base.TextWebSocketFrameHandler;
import cn.crawler.framework.util.Result;
import com.alibaba.fastjson.JSONObject;
import io.netty.channel.Channel;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;

@IocBean
@NettyAction(uri = "/crown/match/fpd", filters = {EncryptFilter.class})
public class PdfAction extends BaseNettyAction {
    private static final Log log = Logs.get();

    @Override
    public Result action(Channel income, JSONObject params) {
        return null;
    }

    /**
     * 半场波胆数据列表订阅
     * 分页推送
     *
     * @return
     */
    @Override
    public Result subscribe(NettyRouter router) {
        log.info("subscribe /crown/match/fpd:" + router);
        if (TextWebSocketFrameHandler.checkSubscribed(router)) {
            return Result.error().addMsg("you have subscribed the key already.");
        }
        return Result.success();
    }

    public static BaseNettyAction instance() {
        return BaseNettyAction.instance(PdfAction.class);
    }
}
